import { defineConfig } from 'vitepress'
import { getSidebarData, getNavData } from './navSidebarUtil'
import updateInfo from './watchJson.json'
import { withMermaid } from 'vitepress-plugin-mermaid'
import { parseVueDoc } from '../plugins/vitepress-vue-doc-plugin'
import { resolve, join } from 'node:path'

console.log(updateInfo)
export default withMermaid({
  mermaid: {},
  markdown: {
    lineNumbers: true,
    config(md) {
      parseVueDoc(md)
    },
  },
  title: 'vitepress-doc',
  description: '这是写描述信息',
  // 如果你计划将你的站点部署到 https://foo.github.io/bar/，那么你应该将 base 设置为 '/bar/'. 默认值：/
  base: '/echarts-note/',
  lang: 'zh-CN',
  appearance: 'dark',
  outDir: './.vitepress/doc-dist',
  lastUpdated: true,
  head: [
    [
      'meta',
      {
        'http-equiv': 'cache-control',
        content: 'no-cache,no-store, must-revalidate',
      },
    ],
    ['meta', { 'http-equiv': 'pragma', content: 'no-cache' }],
    ['meta', { 'http-equiv': 'Expires', content: '0' }],
    // 如果你部署在非根目录，则需要对应修改
    ['link', { rel: 'icon', href: '/favicon.ico' }],
  ],
  themeConfig: {
    // 文档页脚文本配置
    docFooter: {
      prev: '上一篇',
      next: '下一篇',
    },
    lastUpdatedText: '最后更新', // 最后更新时间文本配置, 需先配置lastUpdated为true
    logo: '/logo.png',
    socialLinks: [
      {
        icon: {
          svg: '<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>码云</title><path d="M11.984 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.016 0zm6.09 5.333c.328 0 .593.266.592.593v1.482a.594.594 0 0 1-.593.592H9.777c-.982 0-1.778.796-1.778 1.778v5.63c0 .327.266.592.593.592h5.63c.982 0 1.778-.796 1.778-1.778v-.296a.593.593 0 0 0-.592-.593h-4.15a.592.592 0 0 1-.592-.592v-1.482a.593.593 0 0 1 .593-.592h6.815c.327 0 .593.265.593.592v3.408a4 4 0 0 1-4 4H5.926a.593.593 0 0 1-.593-.593V9.778a4.444 4.444 0 0 1 4.445-4.444h8.296Z"/></svg>',
        },
        link: 'https://gitee.com/free_pan',
      },
    ],
    outlineTitle: '文章目录',
    // 表示文章右侧目录展示h2-h6的内容
    outline: 'deep',
    // nav: [
    //   {
    //     text: 'vue实现动效',
    //     items: [
    //       {
    //         text: 'Transition标签',
    //         link: '/01.vue实现动效/01.Transition标签',
    //       },
    //     ],
    //   },
    // ],
    nav: getNavData({ enableDirActiveMatch: true }),
    sidebar: getSidebarData(),
    // sidebar: {
    //   '/articles/01-作品集/': [
    //     {
    //       text: '工具类',
    //       items: [{text:'xxx',link:'xxx'}],
    //     },
    //     {
    //       text: 'css/scss/less',
    //       items: [],
    //     },
    //     {
    //       text: '移动端',
    //       items: [],
    //     },
    //     {
    //       text: '算法',
    //       items: [],
    //     },
    //     {
    //       text: 'node',
    //       items: [],
    //     },
    //   ],
    // },
  },
})
